package com.xhj.xmly.fragment;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;

import com.xhj.xmly.R;
import com.xhj.xmly.activity.HotRecommendActivity;

/**
 * A simple {@link Fragment} subclass.
 */
public class DownloadBaseFragment extends Fragment implements View.OnClickListener {
    private ImageView image;
    private Button button;

    public DownloadBaseFragment() {
        // Required empty public constructor
    }

    public static DownloadBaseFragment newInstance(int i) {

        Bundle args = new Bundle();
        args.putInt("imageid",i);
        DownloadBaseFragment fragment = new DownloadBaseFragment();
        fragment.setArguments(args);
        return fragment;
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_download_base,container,false);
        image = ((ImageView) view.findViewById(R.id.download_imageView));
        button = ((Button) view.findViewById(R.id.download_btn));
        button.setOnClickListener(this);
        Bundle bundle = getArguments();
        int imageid = bundle.getInt("imageid");
        image.setImageResource(imageid);
        return view;
    }


    @Override
    public void onClick(View view) {
        Intent intent = new Intent(getActivity(), HotRecommendActivity.class);
        startActivity(intent);
    }
}
